<template>
    <div>
      <home-header :city="city"></home-header>
      <home-swiper :swiper="swiper"></home-swiper>
      <home-icons :icons="icons"></home-icons>
      <home-other :hotJd='hotJd' :yLike="yLike"></home-other>
      <home-week :weekList="weekList"></home-week>
      <home-footer></home-footer>
    </div>
</template>

<script>
  //引入组件
  import HomeHeader from '@/pages/home/components/Header'
  import HomeSwiper from '@/pages/home/components/Swiper'
  import HomeIcons from '@/pages/home/components/icons'
  import HomeOther from '@/pages/home/components/Other'
  import HomeWeek from '@/pages/home/components/Week'
  import HomeFooter from '@/pages/home/components/Footer'
  import  axios from 'axios'
  export default {
        name: "Home",
      components:{
          HomeHeader,
          HomeSwiper,
          HomeIcons,
          HomeOther,
          HomeWeek,
          HomeFooter
      },
      data(){
            return{
             city:'',//header
              swiper:[],//swiper
              icons:[],//icons
              yLike:[],
              hotJd:[],
              weekList:[]
            }
      },
    methods:{
          getHomeInfo(){//请求数据
            axios.get('/static/moke/index.json').then(this.getSucc)
          },
        getSucc(res){
            res=res.data;
           //console.log(res)
          if (res.ret && res.data){//如果请求w
            const  data=res.data;
            this.city=data.city;
            this.swiper=data.swiperList;
            this.icons=data.iconList;
            this.hotJd=data.hotJd;
            this.yLike=data.yLike;
            this.weekList=data.WeekList
          }

        }
      },
      mounted(){//钩子函数  一般向后台请求数据后做一些乐舞处理
            this.getHomeInfo();
      }
    }
</script>

<style scoped>

</style>
